package com.xjl.example.publish;

import com.xjl.annoations.NotThreadSafe;
import lombok.extern.slf4j.Slf4j;

import java.util.Arrays;

/**
 * Created by xiaojinlu1990@163.com on 2019/12/24.
 * 私有的域不能对外发布，否则会线程不安全
 *
 */
@Slf4j
@NotThreadSafe
public class Unsafe {

    private  String[] arr = {"a","b","c"};

    public String[] getStatus(){
        return arr;
    }

    public static void main(String[] args) {
        Unsafe unsafe = new Unsafe();
        log.info(Arrays.toString(unsafe.arr));
        unsafe.getStatus()[1]="w";
        log.info(Arrays.toString(unsafe.arr));

    }
}
